using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using CRM.BLL;
using CRM.Entity;
using DP.Common;
using DP.Web.UI;

namespace Web.Knowledge
{
    public partial class KnowledgeBodyRightContent : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                pageInit();
                PageHelper.SetGoBackUrl(this.Page, btnCancel);
            }
        }

        private void pageInit()
        {
            string autoID = (Request.QueryString["AUTOID"] == null) ? "" : Request.QueryString["AUTOID"].ToString();
            string typeID = (Request.QueryString["TYPEID"] == null) ? "" : Request.QueryString["TYPEID"].ToString();


            if (!String.IsNullOrEmpty(autoID))
            {
                CRM_KNOWLEDGE_LIB_DAL lDAL = new CRM_KNOWLEDGE_LIB_DAL();
                CRM_KNOWLEDGE_LIB_Entity lEntity = lDAL.Get_CRM_KNOWLEDGE_LIB_EntityByKey(StringHelper.ToInt(autoID, 0));
                txtBody.Text = lEntity.BODYS;
                txtCDate.Text = lEntity.CDATE;
                txtGHID.Text = lEntity.GHID;
                txtkeyWord.Text = lEntity.KEYWORD;
                txtSolution.Text = lEntity.SOLUTION;
                txtSUBJ.Text = lEntity.SUBJ;
                typeID = lEntity.TYPEID;
            }

            if (!String.IsNullOrEmpty(typeID))
            {
                CRM_KNOWLEDGE_DIRECT_DAL dDAL = new CRM_KNOWLEDGE_DIRECT_DAL();
                CRM_KNOWLEDGE_DIRECT_Entity dEntity = dDAL.Get_CRM_KNOWLEDGE_DIRECT_EntityByKey(typeID);
                if (dEntity != null)
                {
                    lblType.Text = dEntity.KNAME;
                    lblTypeID.Text = dEntity.TYPEID;
                }
            }
        }
    }
}
